/*
 * CTDR_interaction.h
 *
 *  Created on: 2 déc. 2010
 *      Author: mbenoit
 */

#ifndef CTDR_INTERACTION_H_
#define CTDR_INTERACTION_H_
#include "CTDR_Carrier.h"
#include "CTDR_Field.h"
//#include "global.h"
#include <vector>

using namespace std;


class CTDR_Interaction{

private:

	double t;
	double Dt; // Time
	vector<CTDR_Carrier> charges; //A list of charge elements CTDR_Electron
	double rmsX; // RMS radius in X
	double rmsY; // RMS radius in Y
	double rmsZ; // RMS radius in Z
	double MoyZ; // centroid position in Z
	int Q;
	double ErreurMoy;
	double Q0x,Q0y; // Integration constant for collected charge integral
	int Nmax;  	// Maximum number of time steps
	int N;		// Number of charge elements
	double energie;  // Energy of the interaction

public:
	CTDR_Interaction(double x, double y, double z,double Energie,double sigma,double t0,int Nelec,int Q);
	CTDR_Interaction(vector<double> x, vector<double>  y, vector<double> z,double Energie,double sigma,double t0, int Q);
	CTDR_Interaction(double track[4],double Energie,int Nelec,double Q);
	CTDR_Interaction(double x, double y,double Energie,double sigma,double t0,int Nelec,int Q);
	bool iteration(CTDR_Field &A);
	//extern CTDR_Global gCTDR;
	void ComputeRms();
	double GetRmsX();
	double GetRmsY();
	double GetRmsZ();
	double GetMoyZ();
	double GetZmax();
	double GetQx();
	double GetQy();

	void SetQx(double Q);
	void SetQy(double Q);

	void SetDt();

	int GetN();

	CTDR_Carrier GetCharge(int i);

	double Gett();


	void WritePositions(ofstream &sortie);
	//ClassDef(CTDR_Interaction,0) // An interaction
};


#endif /* CTDR_INTERACTION_H_ */
